<template>
  <van-swipe :autoplay="3000">
    <van-swipe-item v-for="image in images" :key="image"  style="padding:0 0.3rem">
      <img :src="image.pic"/>
    </van-swipe-item>
  </van-swipe>
</template>

<script>

import {getBanner} from "../../api/home";

export default {
  name: "SwiperTop",
  data() {
    return {
      images: []
    }
  },
  mounted() {
    this.getSwiperList()
  },
  methods: {
    async getSwiperList() {
      let result = await getBanner()
      // console.log(result)
      if (result.data.code == 200) {
        this.images = result.data.banners
      }
    }
  }
}
</script>

<style lang="less" scoped>
.van-swipe {
  width: 100%;

  .van-swipe__track {
    .van-swipe-item {
      img {
        width: 100%;
        height: 3rem;
        border-radius: 10px;
      }
    }
  }
}
</style>